Skip to content

fix(Comments): a selected or highlighted thread shows its focus ring - #13736

Open
ernestt wants to merge 1 commit into
feat/commentpin-corefrom
fix/comments-selected-focus-ring
Open

ernestt wants to merge 1 commit into
feat/commentpin-corefrom
fix/comments-selected-focus-ring

Conversation

@ernestt

@ernestt ernestt commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #13735 (CommentPin moves to Core), which is stacked on #13702, only so the Comments move includes this fix. It touches none of CommentPin's files and applies cleanly to main (2608fe4) on its own.

User impact

A keyboard user who tabs to a Comments thread that is selected (open) or highlighted by the host sees no focus indicator. That is the thread they are working in, so they lose track of where focus is. Unselected threads show the ring.

Problem and solution fit

  1. Why is there no ring? A thread's hidden toggle draws its focus ring on the thread surface. On a selected or highlighted thread, the forced-colors selection outline came after the ring in the style list. Outside forced colors, that style sets the outline to none, so it overrode the ring.
  2. Why does it harm the task? Focus visibility (WCAG 2.4.7) fails on the state a keyboard user is most likely to be in: the open thread.
  3. Why does it matter? The panel's keyboard model depends on the thread toggle (Enter or Space opens and closes the thread). A user who cannot see which toggle has focus cannot use it.

The ring now comes last in the style list. Forced colors still draw the selection outline on an unfocused selected thread, and the ring on a focused one.

Expected behavior and authority

  • The Comments docs (Accessibility, "Thread toggle"): "The whole surface takes the system focus ring while the toggle has focus."
  • architecture:interaction-modality: keyboard focus uses the shared focus-visible treatment.
  • Component audit rubric BLOCK A15 (graduation issue list): the focus ring is unset on a selected or highlighted thread. It was confirmed open on main in Chromium before this change: outline-style: none on a selected, focused thread.

Smallest restoration

The style order in CommentRow changes so surfaceFocused follows selectedForcedColors. One comment says why the order matters. Nothing else changes.

Evidence

  • Reproduction before the change: Lab/Comments panel story in real Chromium, with the selected thread's toggle focused and no pointer input, so :focus-visible applies. The surface's computed outline is none, in light and dark.
  • Result after the change: solid 2px with the focus color, in light and dark.
  • Representative unchanged path: forced colors, selected but unfocused: the selection outline is the same before and after.
  • Regression test: CommentThread.test.tsx checks the focus-ring classes on [data-thread-surface] for a selected and a highlighted thread. It fails without the fix.
Before After
Selected thread focused, before Selected thread focused, after
Dark, before Dark, after
Forced colors, selected (unchanged) Forced colors, selected and focused (after)
Forced colors, selected Forced colors, selected and focused

Scope

Components: Comments, CommentThread

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run packages/lab/src/Comments: pass. The new cases fail without the fix.

  • pnpm review:pre: 0 findings. prettier and eslint on the changed files: clean.

  • Real Chromium (Playwright) on static Storybook builds of main and this branch, scoped to #storybook-root: light, dark, and forced colors, with the toggle focused and no pointer input.

  • Rebased onto main at 2608fe4, with no change to its own diff (the same patch ID as before the rebase). Repeated on this head: vitest run packages/lab/src/Comments: 96 passed. pnpm review:pre: 0 findings.

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Dec 2, 2026 5:10am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Dec 2, 2026, 5:12 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The CI workflow runs only for pull requests into main, so it runs once this pull request targets main.

Moving the focus ring after the forced-colors selection style restores the ring on a selected or highlighted thread whose toggle has keyboard focus, as the Comments docs describe, and the new test covers both states. There are no blocking findings.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim: no file overlaps with the stacked pull requests, and the change applies cleanly to main: verified (no shared file, the two files are identical on main, and the commit merges cleanly onto main).
  • Claim: on a focused selected or highlighted thread, the later forced-colors selection style removed the ring outside forced colors: verified (the base style order in CommentRow.tsx and that style's null outline defaults).
  • Claim: unselected threads already showed the ring: verified (only selected or highlighted threads take that style, CommentRow.tsx:890).
  • Claim: the ring now comes last, and forced colors keep the selection outline on an unfocused thread and show the ring on a focused one: verified (CommentRow.tsx:242-246 and the forced-colors captures).
  • Claim: the Comments docs say the whole surface takes the focus ring while the toggle has focus: verified (Comments.doc.mjs:143).
  • Claim: the interaction-modality architecture shows the shared focus indicator after keyboard input: verified (docs/architecture/interaction-modality.md INV1).
  • Claim: an audit list records the missing ring as open on main: the list is not in the repository; the base code matches the observation.
  • Claim: only the style order and one comment change in source: verified (diff).
  • Claim: the new test checks the ring's classes for a selected and a highlighted thread and fails without the fix: verified by reading (CommentThread.test.tsx:215-250 against the base order); not run in this review.
  • Claim: tests, lint, formatting and the pre-review script pass: not verified in this review; CI runs them before merge.
  • Claim: before and after captures in light, dark and forced colors: viewed; they match the code.
  • Claim: validated on an earlier main and rebased onto the stack's main base: verified (both commits are on main).
  • Claim: one defect, no tagalong, no new API and no internal context: verified (diff and text scan).
  • File: packages/lab/src/Comments/CommentRow.tsx: clear.
  • File: packages/lab/src/Comments/CommentThread.test.tsx: clear.

Automated review (maintainer link)

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The CI workflow runs only for pull requests into main or a release branch, so it runs once this pull request targets main.

Moving the focus ring after the forced-colors selection style restores the ring on a selected or highlighted thread whose toggle has keyboard focus, as the Comments docs describe, and there are no blocking findings. Reproduced locally: the open thread's surface has no outline on the base and the 2px ring on this head, in light and dark, and the new test fails on the base and passes here.

Claims and files checked

Review mode: full; reason: recipe-changed (many rules)

  • Claim: the change touches none of CommentPin's files and applies cleanly to main: verified (two Comments files; the patch applies to main, where both files match the base branch).
  • Claim: a keyboard user on a selected or highlighted thread saw no focus indicator: verified (reproduced locally on the base in light and dark; the new test fails there for both states).
  • Claim: unselected threads already showed the ring: verified (only selected or highlighted threads take the forced-colors style, CommentRow.tsx:890).
  • Claim: the forced-colors selection style came after the ring and removed it outside forced colors: verified (the base style order and that style's null outline defaults).
  • Claim: the ring now comes last, and only the style order and one comment change in source: verified (CommentRow.tsx:240-246).
  • Claim: forced colors keep the selection outline on an unfocused selected thread and show the ring on a focused one: verified (reproduced locally; the unfocused frames are identical before and after).
  • Claim: the Comments docs say the whole surface takes the system focus ring while the toggle has focus: verified (Comments.doc.mjs:143).
  • Claim: the interaction-modality architecture shows the shared focus indicator after keyboard input: verified (its INV1).
  • Claim: an audit list records the missing ring as open on main: reported; the list is not in the repository, and the base reproduction matches it.
  • Claim: after the change the surface has a solid 2px ring in the focus color, in light and dark, in real Chromium: verified (reproduced locally).
  • Claim: the new test checks the ring's classes for a selected and a highlighted thread and fails without the fix: verified (run locally on this head and on the base with the new test).
  • Claim: the Comments tests pass, and ESLint and Prettier are clean on the changed files: verified (run locally).
  • Claim: the pre-review script reports no findings: reported; not run in this review.
  • Claim: validated on an earlier main and rebased onto a later main without conflicts: verified (both commits are on main).
  • Claim: one defect, no tagalong, no new public API, default or interaction model, and no internal context: verified (diff and text scan).
  • File: packages/lab/src/Comments/CommentRow.tsx: clear.
  • File: packages/lab/src/Comments/CommentThread.test.tsx: clear.

Automated review (maintainer link)

A thread's hidden toggle shows keyboard focus through a focus ring on the
thread's surface. On a selected or host-highlighted thread, the
forced-colors selection outline came after the ring in the style list and
unset its outline outside forced colors, so a keyboard user on the thread
they work in saw no focus. The ring now comes last. Forced colors keep the
selection outline on an unfocused thread.
@ernestt

ernestt commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main at 2608fe4 with the rest of the stack. This pull request's own diff is unchanged: its patch ID is the same as before the rebase, and it applied without conflicts. In the stack, only #13737 changed in content; #13702, #13735, #13736, #13738, #13739, #13740 and #13741 are unchanged apart from the rebase.

Repeated on this head: vitest run packages/lab/src/Comments: 96 passed. pnpm review:pre: 0 findings. It still applies cleanly to main on its own.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet. The CI workflow runs only for pull requests into main or a release branch, so it runs once this pull request targets main.

Moving the focus ring after the forced-colors selection style restores the ring on a selected or highlighted thread whose toggle has keyboard focus, as the Comments docs describe, and there are no blocking findings. Reproduced locally on this head: the new test fails on the base and passes here, and the Comments tests, ESLint and Prettier are clean.

Claims and files checked

Review mode: carry-forward; reason: none

  • Claim: a selected or highlighted thread shows its focus ring (title): verified (the new test asserts the ring's classes for both states; run locally, it passes here and fails on the base).
  • Claim: it is stacked on #13735, which is stacked on #13702: verified (this pull request targets #13735's branch, and #13735 targets #13702's).
  • Claim: the change touches none of CommentPin's files and applies cleanly to main on its own: verified (only two Comments files change, and both are identical on main and the base).
  • Claim: a keyboard user on a selected or highlighted thread saw no focus indicator: verified (the new test fails on the base for both states, run locally).
  • Claim: unselected threads already showed the ring: verified (only selected or highlighted threads take the forced-colors style, CommentRow.tsx:890).
  • Claim: the forced-colors selection style came after the ring and removed it outside forced colors: verified (the base style order and that style's null outline defaults, CommentRow.tsx:162-176).
  • Claim: Enter or Space on the thread toggle opens and closes the thread: verified (Comments.doc.mjs:143; the existing keyboard test passes locally).
  • Claim: the ring now comes last, and only the style order and one comment change in source: verified (CommentRow.tsx:240-246).
  • Claim: forced colors keep the selection outline on an unfocused selected thread and show the ring on a focused one: verified from the code (an unfocused thread gets the same style list on the base and here, and a focused one takes the ring's outline properties last, CommentRow.tsx:242-246); the author's screenshots agree.
  • Claim: the Comments docs say the whole surface takes the system focus ring while the toggle has focus: verified (Comments.doc.mjs:143).
  • Claim: the interaction-modality architecture shows the shared focus indicator after keyboard input: verified (its INV1).
  • Claim: an audit list records the missing ring as open on main: reported; the list is not in the repository, and the base test failure matches it.
  • Claim: in real Chromium the surface had no outline before and has a solid 2px ring in the focus color after, in light and dark: reported (the author's screenshots); the new test, run locally, finds the ring's style and width classes here, and the focus tokens are 2px solid in the accent color.
  • Claim: the new test checks the ring's classes for a selected and a highlighted thread and fails without the fix: verified (run locally on this head and on the base with the new test).
  • Claim: the Comments tests pass (96), and ESLint and Prettier are clean on the changed files: verified (run locally on this head: 4 files, 96 tests).
  • Claim: the pre-review script reports no findings: reported; not run in this review.
  • Claim: rebased onto main with no change to its own diff: verified (the patch is byte-identical to the one reviewed before the rebase, and the named main commit is on main).
  • Claim: one defect, no tagalong, no new public API, visual representation, default or interaction model hidden, and no internal context: verified (diff and text scan; the forced-colors pairing is stated in the description).
  • File: packages/lab/src/Comments/CommentRow.tsx: clear.
  • File: packages/lab/src/Comments/CommentThread.test.tsx: clear.

Automated review (maintainer link)

This branch was successfully deployed

1 active deployment
Preview — e642a67b Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant